﻿using MassPokerTool.Infrastructure.Logging;
using Microsoft.Practices.ObjectBuilder2;
using System;

namespace AnalysisTool.Core.Common.Extensions.Unity.LogCreationExtension
{
    /// <summary>
    /// 
    /// </summary>
    public class LogBuildPlanPolicy : IBuildPlanPolicy
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="logType"></param>
        public LogBuildPlanPolicy(Type logType)
        {
            LogType = logType;
        }

        /// <summary>
        /// 
        /// </summary>
        public Type LogType { get; private set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        public void BuildUp(IBuilderContext context)
        {
            if (context.Existing == null)
            {
                ILogger loggerSevice = new Logger(LogType);
                context.Existing = loggerSevice;
            }
        }
    }
}
